package cn.njutp.DoubleQueue;
import cn.njutp.list.ArrayList;
import cn.njutp.list.List;
public class DoubleQueue<E> {

    private List<E> list=new ArrayList<>();

    public void clear(){
        list.clear();
    }

    public boolean isEmpty(){
        return list.isEmpty();
    }

    public void enQueueFront(E element){
        list.add(0,element);
    }

    public void enQueueEnd(E element){
        list.add(element);
    }

    public E deQueueFromFront(){
        E ans=list.get(0);
        list.remove(0);
        return ans;
    }

    public E deQueueFromEnd(){
        E ans=list.get(list.size()-1);
        list.remove(list.size()-1);
        return ans;
    }

    public int size(){
        return  list.size();
    }

}
